package wpRelations;

import java.util.ArrayList;

import processing.core.PApplet;

public class WP_003_tableWrite extends PApplet {

	/**
	 * @param args
	 */
	
	TsvTable sampleTable;
	String fileName = "Buckminster_Fuller_stuff3.tsv";
	//String fileNamecoby = "Coby_Miller_stuff3.tsv";
	String albert = "Buckminster_Fuller";
	TsvWriterModule twm;
	
	
	public void setup() {
		twm = new TsvWriterModule(this);
		twm.init(fileName);
		twm.printLinks(albert);
		twm.printBackLinks(albert);
		twm.printSuperCategories(albert);
		wArticle cobyArticle = new wArticle(this, albert);
		ArrayList<wCategory> cobyCats = cobyArticle.getCategories();
		for (int i = 0; i < cobyCats.size(); i++) {
		System.out.println("Printing SubCategories / Pages for Supercategory n. " + (i+1) + " of " + cobyCats.size() + "." );
			twm.printSubCategoriesPages(cobyCats.get(i).title);
		}
		ArrayList<wArticle> cobyLinks = cobyArticle.getLinks();
		for (int i = 0; i < cobyLinks.size(); i++) {
			System.out.println("Printing Links / BackLinks for Link n. " + (i+1) + " of " + cobyLinks.size() + "." );
			twm.printLinks(cobyLinks.get(i).title);
			twm.printBackLinks(cobyLinks.get(i).title);
		}
		twm.finish();
//		sampleTable = new TsvTable(this, fileNamecoby);
//		System.out.println("The table " + fileNamecoby + " has " + sampleTable.getRowCount() + " rows.");
//		System.out.println("The table " + fileNamecoby + " has " + sampleTable.data[0].length + " coloumns.");
	}
	
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
